import { defineStore } from 'pinia';

const useInfoStore = defineStore('info', {
  state: (): { dic: { [key: string]: string } } => ({
    dic: {},
  }),
  getters: {},
  actions: {
    // 设置字典
    setInfo(state: { [key: string]: string }) {
      this.$patch({ dic: state });
    },

    getText(code: string) {
      return this.dic[code];
    },
  },
});

export default useInfoStore;
